<!DOCTYPE html>
<!--xmlns:th="http://www.thymeleaf.org"引用thymeleaf-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .page{
            display: inline-block;
            margin: 0px 20px;
            width: 25px;
            height: 25px;
            text-align: center;
            line-height: 25px;
            border-radius: 100%;
        }
        .active{
            background-color: lightpink;
        }
    </style>
</head>
<body>
<a th:href="@{/edit}">添加</a>
<table>
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>邮箱</th>
        <th>操作</th>
    </tr>
    <tr th:each="user : ${userPage.records}">
        <td th:text="${user.id}"></td>
        <td th:text="${user.name}"></td>
        <td th:text="${user.age}"></td>
        <td th:text="${user.email}"></td>
        <td>
            <a th:href="@{/edit(id=${user.id})}">修改</a>
            <a th:href="@{/del(id=${user.id})}">删除</a>
        </td>
    </tr>
</table>
第<span th:text="${userPage.current}"></span>页/共<span th:text="${userPage.pages}"></span>页
<a th:href="@{/getUserList(current=${userPage.current}-1)}" th:if="${userPage.hasPrevious()}">上一页</a>
<a th:href="@{/getUserList(current=${i})}" th:class="${userPage.current==i?'page active':'page'}" class="page" th:each="i : ${#numbers.sequence(1,userPage.pages)}" th:text="${i}"></a>
<a th:href="@{/getUserList(current=${userPage.current}+1)}" th:if="${userPage.hasNext()}">下一页</a>
</body>
</html>